#define _CRT_SECURE_NO_WARNINGS
#include"sort.h"
void test2()
{
	srand((unsigned)time(NULL));
	int N = 90000;
	int* p1 = (int*)malloc(sizeof(int) * N);
	int* p2 = (int*)malloc(sizeof(int) * N);
	int* p3 = (int*)malloc(sizeof(int) * N);
	int* p4 = (int*)malloc(sizeof(int) * N);
	int i = 0;
	while (i<N) {
		p1[i] = rand() + 1;
		p2[i] = p1[i];
		p3[i] = p1[i];
		p4[i] = p1[i];
		i++;
	}
	int start1 = clock();
	BubbleSort(p1, N);
	int end1 = clock();
	int start2 = clock();
	InsertSort(p2, N);
	int end2 = clock();
	int start3 = clock();
	ShellSort(p3, N);
	int end3 = clock();
	int start4 = clock();
	HeapSort(p4, N);
	int end4 = clock();

	printf("Bubble: %d ms\n", end1 - start1);
	printf("Insert: %d ms\n", end2 - start2);
	printf("Shell : %d ms\n", end3 - start3);
	printf("Heap  : %d ms\n", end4 - start4);
	free(p1);
	free(p2);
	free(p3);
	free(p4);
}
void test1()
{
	int arr[] = { 6,5,7,9,3,1,8,4,2 };
	int size = sizeof(arr) / sizeof(int);
	//Print(arr, size);
	//BubbleSort(arr, size);
	//InsertSort(arr, size);
	//ShellSort(arr, size);
	HeapSort(arr, size);
	Print(arr, size);
}
int main()
{
	test2();
	//test1();
	return 0;
}